package com.shujunjun.project.controller;

import com.shujunjun.project.entity.dto.ProjectDTO;
import com.shujunjun.project.feign.IProjectFeign;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class ProjectController {

    final IProjectFeign projectFeign;

    @Resource
    private DiscoveryClient discoveryClient;

    @GetMapping(value = "services")
    public List<String> getServices() {
        return discoveryClient.getServices();
    }

    @GetMapping(value = "project")
    public List<ProjectDTO> project() {
        return projectFeign.list();
    }
}
